﻿@model IEnumerable<E5_KhuyenMaiVang.Models.DEAL>

@{
    ViewBag.Title = "DealHistory";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var DealStatuses = ViewBag.DealStatuses;
    int i = 0;
    double TongTien = 0;
}

<div id="random_deal">
	<div class="title-content"> </div>
    <form method="post" action="@Url.Action("Search","Company")">
	<table width="100%" border="0">
	  <tr>
	    <td width="40%"><div class="title-content">KHUYẾN MÃI CỦA TÔI </div></td>
	    </tr>
        
	  <tr>
	    <td width="40%">
        <small>Tình trạng:</small>
        	    <select size="1" id="select" name="Status">
        		    <option value="0">Tất cả</option>
                    @foreach (var item in DealStatuses)
                    {
                        <option value="@item.StatusID">@item.StatusName</option>
                    }                
        	    </select> 
            
        </td>
	    </tr>
         <tr>         
	    <td width="40%">
        <br/>
        <small>Tên deal:</small>        
        	<input type="text" name="DealName" /> <input type="submit"" value="Tìm"/>            
        </td>
	    </tr>
       
	  <tr>
	    <td><br/><small>Trang:</small> : <a href="#" style="text-decoration:none ; color:#333; font-weight:bold ;">1</a> <a href="#" style="text-decoration:none ; color:#333; font-weight:bold ; ">2</a></td>
	    </tr>
	  </table>
       </form>
      <br/>
	<table width="791" style="border:1px #333 solid ; border-collapse:collapse; border-spacing: 0px;">
	  <tr> 
        <td width="5%" align="center" class="namecolumn" scope="col">STT</td>
	    <td width="10%" align="center" class="namecolumn" scope="col">Deal</td>
         <td width="10%"align="center" class="namecolumn" scope="col">Số lượng bán </td>         
	    <td width="10%"align="center" class="namecolumn" scope="col">Giá</td>
         <td width="10%"align="center" class="namecolumn" scope="col">Doanh thu</td>
	    <td width="10%"align="center" class="namecolumn" scope="col">Tình trạng </td>
	    </tr>
        @foreach (var item in Model)
        {
            TongTien += (item.SoldQuantity * item.Discount);
            <tr  style="border-bottom:2px #666 solid;">
                <td align="center" class="rowcolumn">@(++i)</td>
	            <td align="center" class="rowcolumn"><a href="#">@item.DealName</a></td>
	            <td align="center" class="rowcolumn">@item.SoldQuantity</td>
	            <td align="center" class="rowcolumn">@item.Discount</td>
                <td align="center" class="rowcolumn">@(item.SoldQuantity*item.Discount)</td>
	            <td align="center" class="rowcolumn"><b style="color:#97C30A">@item.DEAL_STATUS.StatusName</b></td>
	        </tr>
        }               
	  </table>
    </div>
    <div id="random_deal">
    <b><small>Tổng số khuyến mãi: </small><small style="color:Green">@Model.Count()</small></b>
    <br />
    <b><small>Tổng số tiền: </small><small style="color:Red">@TongTien</small></b>
    </div>
   <table width="100%"></table> 
